﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kocic.RepositoryManagement.SystemFile
{
    /// <summary>
    /// Base class for an object representing a line in a file.
    /// </summary>
    public class LineObject
    {
        private Int32 _lineNumber = 0;
        private String _contents = string.Empty;

        /// <summary>
        /// Gets or sets the line number of the line.
        /// </summary>
        public virtual Int32 LineNumber
        {
            get { return _lineNumber; }
        }

        /// <summary>
        /// Sets the line number of the line
        /// </summary>
        internal Int32 LNumber
        {
            set
            {
                if (value <= 0 || value > Int32.MaxValue)
                {
                    throw new InvalidOperationException("The line number cannot be less than or equal to 0 or greater than the max value of the Int32 struct.");
                }

                _lineNumber = value;
            }
        }

        /// <summary>
        /// Gets or sets the contents of the line.
        /// </summary>
        public virtual String Contents
        {
            get { return _contents; }
            set { _contents = value; }
        }

        /// <summary>
        /// Creates an instance of the LineObject class.
        /// </summary>
        public LineObject()
        {

        }

        /// <summary>
        /// Returns a System.String that represents the current LineObject.
        /// </summary>
        public override string ToString()
        {
            return _contents;
        }

        /// <summary>
        /// Builds the underlying contents of the line object.
        /// </summary>
        protected internal virtual void BuildContents()
        {

        }
    }
}